home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / mac / data / xxi_appendice_dvd.swf / scripts / __Packages / CHistory.as < prev    next >
Text File  |  2007-11-08  |  2KB  |  76 lines

  1. class CHistory extends Object
  2. {
  3.    function CHistory()
  4.    {
  5.       super();
  6.       this.mMaxLenght = 50;
  7.       this.mHistory = new Array();
  8.       this.mPosition = 0;
  9.    }
  10.    function Back()
  11.    {
  12.       var _loc2_ = undefined;
  13.       if(this.mPosition > 0)
  14.       {
  15.          this.mPosition = this.mPosition - 1;
  16.          _loc2_ = this.mHistory[this.mPosition];
  17.       }
  18.       return _loc2_;
  19.    }
  20.    function Forward()
  21.    {
  22.       var _loc2_ = undefined;
  23.       if(this.mPosition < this.GetLength() - 1)
  24.       {
  25.          this.mPosition = this.mPosition + 1;
  26.          _loc2_ = this.mHistory[this.mPosition];
  27.       }
  28.       return _loc2_;
  29.    }
  30.    function Goto(inPosition)
  31.    {
  32.       var _loc2_ = undefined;
  33.       if(inPosition >= 0 && inPosition < this.GetLength())
  34.       {
  35.          this.mPosition = inPosition;
  36.          _loc2_ = this.mHistory[this.mPosition];
  37.       }
  38.       return _loc2_;
  39.    }
  40.    function Add(inObject, inFrom)
  41.    {
  42.       if(this.mHistory.length > 0)
  43.       {
  44.          var _loc4_ = this.mHistory[this.mHistory.length - 1];
  45.          if(inObject.mId == _loc4_.id && inObject.mTipo == _loc4_.tipo)
  46.          {
  47.             return false;
  48.          }
  49.       }
  50.       var _loc2_ = new Object();
  51.       _loc2_.id = inObject.mId;
  52.       if(inObject.mTipo == undefined)
  53.       {
  54.       }
  55.       _loc2_.tipo = inObject.mTipo;
  56.       _loc2_.titolo = inObject.mTitolo;
  57.       _loc2_.label = inObject.mTitolo;
  58.       _loc2_.from = inFrom;
  59.       this.mHistory.push(_loc2_);
  60.       this.mPosition = this.mHistory.length - 1;
  61.       return true;
  62.    }
  63.    function GetLength()
  64.    {
  65.       return this.mHistory.length;
  66.    }
  67.    function GetPosition()
  68.    {
  69.       return this.mPosition;
  70.    }
  71.    function GetData()
  72.    {
  73.       return this.mHistory;
  74.    }
  75. }
  76.